<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
    </style>
</head>
<body>
    <form action="test.php" enctype="multipart/form-data" method="post">
        <input type="text" name="name">
        <input type="file" title="file" name="testFile" style="width: 200px;" multiple="true">
        <input type="button" value="提交">
    </form>
    <img src="" alt="">
</body>
<script src="inc\js\jquery-3.6.0.min.js"></script>
<script>
    $('[type=button]').on('click', function(){

        let files = $('form [name=testFile]').prop('files')
        let form = new FormData()
        form.append('file', files[0])
        form.append('username', '666')
        $.ajax({
            data: form,
            type: 'POST',
            url: './test.php',
            cache: false,
            processData: false,
            contentType: false
        })
        .done(function(data){
            console.log(data)
        })
    })
</script>
</html>